<template>
	<layout :loading="loading" curPage="daliyItems" :title="data.id ? '修改日常维护项目':'新增日常维护项目'">
	
		<form class="layui-form" @submit="submit" data-action="/admin/daliyItems/save" data-rediret="/pages/daliyItems/daliyItemsList">
			
			<radioGroup title="类型" name="x.type|类型|count" :value="data.type" :list="typeList"></radioGroup>
			
			<inputGroup type="text" title="标题" name="x.title|标题|0~30" :value="data.title"  placeholder="请输入标题"></inputGroup>
			
			<inputGroup type="text" title="维护内容" name="x.content|维护内容|0~200" :value="data.content"  placeholder="请输入维护内容"></inputGroup>
			
			<inputGroup type="number" title="间隔天数" name="x.duration|间隔天数|count" :value="data.duration" addOn="天"  placeholder="请输入间隔天数"></inputGroup>
			
			<inputGroup type="number" title="排序" name="x.orderNum|排序|count|empty" :value="data.orderNum"  placeholder="选填"></inputGroup>
			
			
			<div class="layui-form-item">
				<div class="layui-input-block">
					<input type="hidden" name="x.id" :value="data.id" style="display: none;">
					<button class="layui-btn" form-type="submit">{{ !data.id ? '保存' : '修改'}}</button>
					<button class="layui-btn layui-btn-primary" form-type="reset">重置</button>
					<button class="layui-btn layui-btn-primary" @click="kit.goBack('index')">取消</button>
				</div>
			</div>
		</form>

	</layout>
</template>

<script>
	export default {
		data() {
			return {
				loading: true ,
				typeList:[],
				data : {
					id : '',
					type : 1
				}
			}
		},
		onLoad(params) {
			this.data.id = params.id || "" ;
			this.loadData();
		},
		onShow() {
			
		},
		methods: {
			
			submit:function(e){
				this.form.submit(e);
			},
			
			loadData : function(e){
				var that = this ;
				var data = {
					id : this.data.id
				} ;
				this.kit.get("/admin/daliyItems/info",data,function(res){
					that.data = res.data || that.data ;	
					that.typeList = res.typeList || that.typeList ;	
					that.loading  = false ;
				});
			}
		}
	}
</script>